/**
 *  julive
 *
 *  Create by songli on 2021/05/24
 *  Copyright © 2021 居理买房网. All rights reserved.
 */

package subscriber

import (
	"context"
	"git.julive.com/micro/pkg/broker"
	"git.julive.com/micro/pkg/logx"
	"go.uber.org/zap"
)

type User struct {
	ctx    context.Context
	logger *zap.Logger
}

func NewUser(ctx context.Context) *User {
	logger := logx.Logger.With(zap.String("module", "user/subscriber"), zap.String("svc", "user"))
	svc := &User{ctx, logger}
	return svc
}

func (svc *User) CreateHandle(msg *broker.Message) error {
	logger := svc.logger.With(zap.String("func", "CreateHandle"))
	logger.Debug("user_create", zap.String("key", msg.Key), zap.String("body", string(msg.Body)))
	return nil
}

func (svc *User) UpdateCountHandle(msg *broker.Message) error {
	logger := svc.logger.With(zap.String("func", "UpdateCountHandle"))
	logger.Debug("user_update_count", zap.String("key", msg.Key), zap.String("body", string(msg.Body)))
	return nil
}
